package cn.iocoder.yudao.module.wms.dal.mysql.vendorclassify;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.wms.controller.admin.vendorclassify.vo.VendorClassifyPageReqVO;
import cn.iocoder.yudao.module.wms.dal.dataobject.vendorclassify.VendorClassifyDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.Collection;

/**
 * 供应商分类 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface VendorClassifyMapper extends BaseMapperX<VendorClassifyDO> {

    default PageResult<VendorClassifyDO> selectPage(VendorClassifyPageReqVO reqVO, Collection<Long> parentIds) {
        return selectPage(reqVO,new LambdaQueryWrapperX<VendorClassifyDO>()
                .likeIfPresent(VendorClassifyDO::getCode, reqVO.getCode())
                .likeIfPresent(VendorClassifyDO::getName, reqVO.getName())
                .eqIfPresent(VendorClassifyDO::getParentId, parentIds)
                .betweenIfPresent(VendorClassifyDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(VendorClassifyDO::getId));
    }

}